package com.wqtz.chechai.adapter;

import android.view.View;

import com.makeramen.roundedimageview.RoundedTransformationBuilder;
import com.squareup.picasso.Transformation;
import com.wqtz.chechai.R;
import com.wqtz.chechai.base.rebaseadapter.MyHolder;
import com.wqtz.chechai.base.rebaseadapter.RecyclerAdapter;

import java.util.List;

/**
 * 项目名称： CheChai
 * 创建人 :  Kisum
 * 创建时间: 2017/2/7
 */

public class PhotoAdapter extends RecyclerAdapter<String> {
    Transformation transformation;
    public PhotoAdapter(int rsId, List<String> data) {
        super(rsId, data);
        transformation = new RoundedTransformationBuilder()
                .borderWidthDp(3)
                .cornerRadiusDp(5)
                .oval(false)
                .build();

    }

    delOnClickCallBack mDelOnClickCallBack;
    //设置监听事件回调回调
    public void setDelOnClickCallBack(delOnClickCallBack mDelOnClickCallBack){
        this.mDelOnClickCallBack = mDelOnClickCallBack;
    }

    @Override
    public int itemType(int position) {
        return 0;
    }



    @Override
    public void onBindMyViewHolder(MyHolder holder, final int position, List<String> data) {
        holder.setRoundImag(R.id.selectedImg,data.get(position));
        if(data.get(position).equals("default")){
            holder.getView(R.id.del_mark).setVisibility(View.GONE);
            holder.getView(R.id.selectedImg).setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    mDelOnClickCallBack.onDelClick(position);
                }
            });
        }else {
            holder.getView(R.id.del_mark).setOnClickListener(new View.OnClickListener() {
                @Override
                public void onClick(View v) {
                    mDelOnClickCallBack.onDelClick(position);
                }
            });
        }

    }

    public interface delOnClickCallBack{
        void onDelClick(int position);
    }
}